10 REM PROGRAM TO VERIFY SUBROUTINE SELECTION MODULE
20 DIM A$(25),I%(25)
30 FOR I = 1 TO 25: READ A$(I): NEXT :N = 25: GOTO 1000
40 DATA A TEST 1,A TEST 2,A TEST 3,A TEST 4,A TEST 5,A TEST 6,A TEST 7,A TEST 8,A TEST 9,A TEST 10
50 DATA B TEST 1,B TEST 1A,B TEST 1A,BTEST 4,B TEST 5,B TEST 6,B TEST 7,B TEST 8,B TEST 8,B TEST 9
60 DATA C TEST 1,C TEST 2,C TEST 3,C TEST 4,C TEST 5
1000 PRINT " ": PRINT " ": PRINT "NOW AT SIMULATED MENU. ENTER 1 FOR": INPUT "SUBROUTINE, OR 0 TO END ";Z$:Z = VAL(Z$): IF Z = 0 THEN END
1010 GOSUB 2000
1020 PRINT " ": PRINT " ": PRINT "THE SELECTION WAS ";A$(LF%)
1030 PRINT " ": GOTO 1000
2000 HOME : PRINT "PLEASE ENTER AS MUCH OF THE NAME AS YOU": PRINT "CAN. I WILL TRY FIRST FOR A COMPLETE": PRINT "MATCH, AND THEN TRY TO MATCH THE FIRST": PRINT "FEW LETTERS": PRINT " ": INPUT IN$: IF IN$ = "" THEN POP : GOTO 1000
2010 L = LEN(IN$):FI% = 0:LF% = 0: FOR I = 1 TO N:I%(I) = 0: NEXT
2020 FOR I = 1 TO N: IF A$(I) = IN$ THEN I%(I) = 1:FI% = FI% +1:LF% = I
2030 NEXT
2040 IF FI% = 1 THEN RETURN
2050 IF FI% >1 THEN 2110
2060 FOR I = 1 TO N: IF LEFT$(A$(I),L) = IN$ THEN I%(I) = 1:FI% = FI% +1:LF = I
2070 NEXT
2080 IF FI% = 1 THEN RETURN
2090 IF FI% >1 THEN 2110
2100 PRINT : PRINT CHR$(7);"NO MATCH FOUND. PLEASE PRESS RETURN": INPUT "FOR MENU ";Z$: POP : GOTO 1000
2110 HOME : FOR I = 1 TO N: IF I%(I) = 0 THEN 2130
2120 PRINT I;: HTAB 4: PRINT LEFT$(A$(I),35)
2130 NEXT
2140 VTAB 22: CALL -868: INPUT "ENTER NUMBER OR M FOR MENU ";Z$: IF Z$ = "M" THEN POP : GOTO 1000